package edu.unlv.cs.ladders.security;

import java.io.Serializable;
import java.util.Collection;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

public class NewlyRegisteredAuthentication implements Authentication, Serializable {
	private static final long serialVersionUID = 1L;
	private UserDetails user;
	private boolean authenticated = true;

	public NewlyRegisteredAuthentication(UserDetails user) {
		this.user = user;
	}
	public Collection<GrantedAuthority> getAuthorities() {
		return user.getAuthorities();
	}

	public Object getCredentials() {
		return null;
	}

	public Object getDetails() {
		return user;
	}

	public Object getPrincipal() {
		return user;
	}

	public boolean isAuthenticated() {
		return this.authenticated;
	}

	public void setAuthenticated(boolean isAuthenticated)
			throws IllegalArgumentException {
		this.authenticated = isAuthenticated;
	}

	public String getName() {
		return user.getUsername();
	}

}
